<include file="__THEME__/header" />
<link href="../Public/css/space.css" rel="stylesheet" type="text/css" />
<script>
var uid = '{$uid}';
var notify_num = '{$space['notify']['count']}';
//回复留言
function doreplaywall(fid){
	var content = $.trim($("#replay_content_"+fid).val());
	if(content){
		$.post('{:U("space/Wall/dowall")}',{touid:uid,fid:fid,content:content},function(result){
			result = eval("("+result+")");
			var html = '<div class="appra"><div class="headpic50 L">'
					 + '<a href="__APP__&mod=View&uid='+result.fromuid+'"><img src="'+result.userface+'" /></a></div>'
	        		 + '<div class="LC2">'
	       			 + '<p class="bg01 pl5"><a href="__APP__&mod=View&uid='+result.fromuid+'">'+result.username+'</a> {:L("just_now")}</p>'
	        		 + '<p class="pl10 lh30">'+result.content+'</p>'
	      			 + '</div><div class="C"></div></div>';
			$("#replay_content_"+fid).val('');
			$("#doreplay_"+fid).hide();
	        $("#doreplay_"+fid).before(html);
		});
	}else{
		$.tbox.no("<php>echo L('content_can_not_empty') </php>",'{:L("wrong")}');
	}
}

//删除留言
function dodelwall(id){
	if(confirm('L("confirm_to_delete_message")')){
		$.post("{:U('space/Wall/dodel')}",{id:id},function(result){
			$("#wall_"+id).slideUp("fast",function(){
				$(this).remove();
			});
		});
	}
} 

//添加记录
function doadd(){
	var content = $.trim($("#record_contend").val());
	if(content){
		if(content.length>140){
			$.tbox.no("{:L('record_content_too_more')}","{:L('wrong')}");
			return false;
		}else{
			$.post('{:U("home/Record/doadd")}',{content:content},function(result){
				if(result){
					$('#record_success').fadeTo(2000,1,function(){
					   $(this).hide();
					});					

					var html=result+'<span class="ml10 f12 cl06">{:L("just_now")}</span>';
					$('#record_show').html(html);
					$("#record_contend").val('');
					$("#record_input_count").html('{:L("can_input_character")}');
				}
			});
		}
	}else{
		$.tbox.no('{:L("record_content_no_empty")}','{:L("wrong")}');
	}
}

//删除通知
function delNotify(id){
	$.post('{:U("home/Message/dedelnotify")}',{id:id},function(txt){
		if(txt){
			$("#notify_"+id).slideUp("fast",function(){
				$(this).remove();
			});
		}else{
			alert('{:L("ignore_error")}');
		}
	});
}

function setNotifyRead(id,nochange){
	$.post('{:U("home/Message/setnotify")}',{id:id,type:'setread'},function(txt){
		if(!nochange){
			if(txt){
				notify_num = notify_num -1;
				
				if(notify_num==0){
					$('#notify').slideUp("fast",function(){
						$(this).remove();
					});		
				}else{
					$("#notify_count").html(notify_num);
					$("#notify_"+id).slideUp("fast",function(){
						$(this).remove();
					});		
				}
			}else{
				alert('{:L("set_error")}');
			}
		}
	});
}

$(document).ready(function(){
	$('#record_contend').focus(function(){
		$('#css_record_contend').attr('class','heart_b_01');
	});
	$('#record_contend').blur(function(){
		if($(this).val().length=='0'){
			$('#css_record_contend').attr('class','heart_b');
		}
	});
	//不开输入法，监听keypress事件;开输入法监听keyup事件以及以下会改变内容的按键：空格32,橡皮键8,回车13,ctrl+v
	$("#record_contend").keyup(function(event){
		//alert(event.keyCode);	//ctrl 17 + v 86
		if(event.keyCode==32 || event.keyCode==8 || event.keyCode==13){
			checkLength(this,'record_input_count',140);
		}
	}).keypress(function(){
		checkLength(this,'record_input_count',140);
	}).blur(function(){
		checkLength(this,'record_input_count',140);
	});


	$("ul[rel='tab'] li").click(function(){
		$.each( $("ul[rel='tab'] li") , function(i, n){
			$(this).removeClass('on');
		});
		$(this).addClass('on');		
	})
	
	loadfeed('attention',0);
	
	$("#notify dd a[rel!='filtrate']").click(function(){
		$("#notify dd").click(function(){
			var id = $(this).attr('id').split('_');
			setNotifyRead( id[1] , true );
		});
	});
	
	var shortcutOpt = {'target':'record_contend'};
	shortcut('ctrl+return',	function(){doadd();},shortcutOpt);		
});

function loadfeed(type,fid){
	$('#feed_list_content').html('<ul><li style="text-align:center"><img src="__PUBLIC__/images/loading_blue_big.gif"></li></ul>');
	$.post("{:U('home/User/feed')}",{type:type,fid:fid},function(txt){
		$("#feed_list_content").html(txt);
	});	
}

//检查字数
function checkLength(o,tpoint,num){
	var lengthnum = $(o).val().length;
	var shownum;
	if(num>=lengthnum){
		shownum = num-lengthnum;
		$("#record_input_count").css('color','#999999');
		$("#record_input_count").html('{:L("can_input_info_1")}'+shownum+'</strong>{:L("can_input_info_2")}');
	}else{
		shownum = lengthnum - num;
		$("#record_input_count").css('color','red');
		$("#record_input_count").html('{:L("can_input_more_info_1")}'+shownum+'</strong>{:L("can_input_more_info_2")}');
        return false;
	}
}
</script> 
<div class="contents lbg">
  <!--左边信息 begin-->
	<include file="../Public/home_left" />
	<!--左边信息 end-->
  <div class="contents_min lineR">
    <div class="write_info mb10">
      <h3 class="lh18">
      	<span class="R f12 fn cl03">{:L('level')}：<span class="cl04">{:getUserTitle($uid,$space['info']['credit_exp'])}</span>&nbsp;&nbsp;
			{:L('contribute')}：<span class="cl04">{$space['info']['credit_exp']}</span>&nbsp;&nbsp;
			{:L('score')}：<span class="cl04">{$space['info']['credit_score']}</span>&nbsp;&nbsp;
	  </span><a href="#">{:getUserName($mid)}</a> <span class="f11 fn alP cl04">{$space['baseinfo']['usersex']['value']}</span>
      <span class="web_address">{:U('space/View/index',array('uid'=>$space['info']['cardId']))}</span>
      </h3>
	      <h4 class="cl03 mb10 fn f14">
	      <div id="record_show"><php>if($space['record']){</php> {$space['record']['content']} <php>}else{</php>{:L('do_nothing')}<php>}</php>
	        <span class="cl06 f12 fn" >
	        <php>if($space['record']){</php>{$space['record']['cTime']|friendlyDate}<php>}</php>
	        </span>
	      </div>
	      </h4>
            <form action="{:U('space/Record/addrecord')}" method="post" autocomplete="off">
           <div class="heart_box_02">
        <div class="catch"><span class="R cl06 pr10" id="record_input_count" style="*padding-bottom:7px; *margin-bottom:0">{:L('can_input_character')}</span><span class="heart_font">{:L("record_about")}</span></div>
        <div><div class="blest" id="record_success" style="display:none"></div><div class="heart_b" id="css_record_contend"><textarea name="textarea" id="record_contend"   style="word-break:break-all;"></textarea></div></div>
        <div class="pr10"><span class="R mt10"><input type="button"  class="btn_mini ml10 mb5" value="{:L('add_new')}" onclick="doadd()"/></span><span class="heart_b_f"><a class="icon_app" href="{:U('home/blog/post')}">{:L('post_blog')}</a><a class="icon_hall" href="{:U('bbs/Index/post')}">{:L('post_thread')}</a><a class="icon_iss"href="{:U('ask/index/post')}">{:L('post_ask')}</a></span></div><div class="C"></div>
      </div>
       </form>
<php>if($space['notify']['list']['data']){</php>	  
      <div id="notify">
      <dl class="give" >
      		<dt>{:L('notify')}<span class="fn pl5">(<span class="cl04" id="notify_count">{$space['notify']['count']}</span>{:L('notify_unread')})</span></dt>
			<volist id="vo" name="space['notify']['list']['data']">
	            <dd id="notify_{$vo.id}"><span><span class="DE"><a onclick="setNotifyRead({$vo.id})" rel="filtrate" href="javascript:void(0)" class="del">{:L("delete")}</a></span>
				<span class="cc">{$vo.title}</span></span><a href="javascript:void(0)"></a>
				</dd>
			</volist>
      </dl>
       <div class="alR f12"><a href="{:U('Home/Message/notify')}">{:L('to_see_more')}</a></span></div>
       </div>
<php>}</php>
	</div>
      <div class="dynamic">
        <div class="tab" >
            <ul rel="tab">
                <li  class="on" onclick="loadfeed('attention',0);" condition="attention"><span >{:L("feed_following")}</span></li>
                <li condition="all" onclick="loadfeed('all',0);" ><span >{:L("feed_all")}</span></li>
				<php>if($space['grouplist']['list']){</php>
                <li condition="group" style="position:relative;">
                	<div class="group_new" id="group_new" onmouseout="this.className='group_new'" onmouseover="this.className='group_new_over'">
                    <span style="padding-right:10px; "><a href="javascript:void(0)" onclick="loadfeed('group',0);">{:L('feed_group')}</a></span>
                    	<div class="box">
                    		<volist id="vo" name="space['grouplist']['list']">
                        		<a href="javascript:void(0)" onclick="loadfeed('group',{$vo.gid});$('#group_new').attr('class','group_new')" fid="{$vo.gid}" style="display: block;">{$vo.name}</a>
							</volist>
                        </div>
                    </div>
                </li>
				<php>}</php>
            </ul>
        </div>
        <div class="list_conter" id="feed_list_content"></div>
        <div class="tab" ><ul><li class="on" ><span >{:L('colleague_message')}</span></li></ul></div>
        <div class="list_conter">
          <ul id="wall_list" class="book">
<volist id="vo" name="space['walls']">
            <li id="wall_{$vo.id}" class="Fli">
              <div class="headpic50 L"><a href="{:U('space/View','uid='.$vo[fromuid])}"><img src="{$vo.fromuid|getUserFace='s'}" /></a></div>
              <div class="LC"><p class="bg01 pl5"><span class="R pr10"> <php>if($vo['uid']==$mid){</php><a href="javascript:void(0)" onclick='$("#doreplay_{$vo.id}").show()'>{:L("reply")}</a> <a href="javascript:void(0)" onclick="dodelwall({$vo.id})">{:L("delete")}</a><php>}</php></span>
                  <a href="{:U('space/view','uid='.$vo[fromuid])}">{$vo.fromuid|getUserName}</a> {$vo.cTime|friendlyDate} <eq name="vo['stealth']" value="1"><font color="red">【{:L("whisper")}】</font></eq></p>
                <p class="pl5 pt5 lh20">
                		{$vo.content}
                </p>
              </div>
              <div id="replaylist_{$vo.id}">
   			  <volist id="svo" name="vo['reply']">
              <div class="appra">
                <div class="headpic50 L"><a href="{:U('space/View','uid='.$svo[fromuid])}"><img src="{$svo.fromuid|getUserFace='s'}" /></a></div>
                <div class="LC1">
                  <p class="bg01 pl5"><a href="{:U('space/View','uid='.$svo[fromuid])}">{$svo.fromuid|getUserName}</a> {$svo.cTime|friendlyDate}</p>
                  <p class="pl5 pt5 lh20">{$svo.content}</p>
                </div>
                <div class="C"></div>
                </div>
			  </volist>
			  
              <div id="doreplay_{$vo.id}" style="display:none" class="appra">
                <div class="headpic50 L"><img src="{$mid|getUserFace='s'}" width="50"/></div>
                <div class="LC2" >
                  <textarea name="replay_content_{$vo.id}" id="replay_content_{$vo.id}" class="w430_tx line"></textarea><br />
                  <input class="btn_sea" name="" onclick="doreplaywall({$vo.id})" type="button" value="{:L('reply')}" /> <input class="btn_sea" name="" onclick='$("#doreplay_{$vo.id}").hide()' type="button" value="{:L('cancel')}" />
                </div>
               </div>
               
             </div>
            </li>
</volist>
          </ul>
          <p class="C"></p>
          <p class="R lh30 mb20"><a href="{:U('home/Message/index/',array('type'=>'wall'))}">{:L("to_see_more")} </a></p>
        </div>
        <div class="C"></div>
  </div>
  </div>
  <!--右边信息 begin-->
  <div class="contents_right">
    <div class="ballot"> <span class="comment"><a href="{:U('home/Colleague/followMe')}">
      <p class="pt5">{$FollowedCount}</p></a>
      <p class="pt5">{:L('followee')}</p>
      </span> <span class="comment Le"><a href="{:U('home/Colleague/followYou')}">
      <p class="pt5">{$FollowCount}</p></a>
      <p class="pt5">{:L('following')}</p>
      </span><span class="C"></span></div>
    <div class="C"></div>
    <div class="atten_deta">
      <p class="f14 fB pb10 pl5">{:L('followee')}</p>
      <ul>
      <php>if($space['followMe']){</php>
	      <volist id="vo" name="space['followMe']">
	        <li><span class="headpic50h"><a class="pic_box" href="{:U('space/View','uid='.$vo)}"><img src="{$vo|getUserFace='m'}"/></a></span>
	          <span class="OverHW lh18">
	          <a href="{:U('space/View','uid='.$vo)}" rel="{$vo}" class="preview">{$vo|getUsername}</a>
	          </span>
	        </li>
	      </volist>
	  <php>}else{</php>
	  		{:L('no_followee')}
	  <php>}</php>
      </ul>
       <p class="C"></p>
       <p class="f12 pt10 pr5 alR"><a href="{:U('home/Colleague/followMe')}">{:L('to_see_more')}</a></p>
    </div>
    <div class="C"></div>
    
    <div class="atten_deta">
      <p class="f14 fB pb10 pl5">{:L('following')}</p>
      <ul>
      <php>if($space['followYou']){</php>
	      <volist id="vo" name="space['followYou']">
	        <li><span class="headpic50h"><a class="pic_box" href="{:U('space/View','uid='.$vo)}"><img src="{$vo|getUserFace='m'}" /></a></span>
	          <span class="OverHW lh18">
	          <a href="{:U('space/View','uid='.$vo)}" rel="{$vo}" class="preview">{$vo|getUsername}</a>
	          </span>
	        </li>
	      </volist>
	  <php>}else{</php>
	  		{:L('no_following')}
	  <php>}</php>
      </ul>
        <p class="C"></p>
        <p class="f12 pt10 pr5 alR "><a href="{:U('home/Colleague/followYou')}">{:L('to_see_more')}</a></p>
    </div>
    <div class="C"></div>          
      
    <div class="atten_deta">
      <p class="f14 fB pb10 pl5">{:L('visitor')}</p>
      <ul>
      <php>if($space['visitor']){</php>
	      <volist id="vo" name="space['visitor']">
	        <li><span class="headpic50h"><a class="pic_box" href="{:U('space/View','uid='.$vo['visitor'])}"><img src="{$vo.visitor|getUserFace='m'}" width="45" height="45" /></a></span>
	          <span class="OverHW lh18">
	          <a href="{:U('space/View','uid='.$vo['visitor'])}" rel="{$vo['visitor']}" class="preview">{$vo.visitor|getUsername}</a>
	          </span>
	        </li>
	      </volist>
	  <php>}else{</php>
	  		<li>{:L('no_visitor')}</li>
	  <php>}</php>
      </ul>
       <p class="C"></p>
       <p class="f12 pt10 pr5 alR "><a href="{:U('home/Colleague/track')}">{:L('to_see_more')}</a></p>
    </div>
    <div class="C"></div>
    
  </div>
  <!--右边信息 begin-->
  <div class="C"></div>
</div>
<include file="__THEME__/footer" />